$(document).ready(function () {
    $('#sys_slider_code').tinycarousel({
        duration:200,
        display:4
    });
    $('#sys_slide_viewed').tinycarousel({
        duration:200,
        display:4
    });

    $("#star_hotel_promotion").msDropdown();

    var allstar = $(".allstar");
    var yeshotel = $("#yeshotel");
    var nohotel = $("#nohotel");
    var star = 0;
    var city = 0;
    var special = 0;

    $('.allstaricon').click(function () {
        star = $(this).attr("data-key");
        $("#choose-star").find("li.active").removeClass("active");
        $(this).addClass("active");
        getPromotion();
        return false;
    });

    $(".allcity").click(function(){
        city = $(this).attr("data-key");
        $("#listcity").find("a.active").removeClass("active");
        $(this).addClass("active");
        getPromotion();
        return false;
    });

    $(".allspecial").click(function(){
        special = $(this).attr("data-key");
        $("#listspecial").find("a.active").removeClass("active");
        $(this).addClass("active");
        getPromotion();
        return false;
    });

    function getPromotion(){
        nohotel.hide();
        yeshotel.hide();
        $.post(
            'ajax.php?act=promotion&code=getPromotionHotel',
            {   city:city,
                star:star,
                special:special
            },
            function (data) {
                yeshotel.html(data.item);
            }, 'json'
        );
        yeshotel.show();
    }
});